/*
 * Session.hpp
 *
 *  Created on: Feb 1, 2015
 *      Author: wasp
 */

#ifndef SESSION_HPP_
#define SESSION_HPP_
#include <huctx.h>
#include <sbreturn.h>
namespace de
{
    namespace heimweghelden
    {
        namespace security
        {

            class Session
            {
            public:
                Session(sb_GlobalCtx sbCtx, sb_RNGCtx rngCtx);
                Session(sb_GlobalCtx ctx, QString base64Key);
                virtual ~Session();
                int status() { return _status; }
                bool statusOk() { return _status == SB_SUCCESS; }
                QString encrypt(QString input);
                QString decrypt(QString base64input);
            private:
                sb_Params _aesParams;
                sb_Key _aesKey;
                sb_GlobalCtx sbCtx;
                QString keyBase64String;
                int _status;
                bool master;
                bool removePadding(QByteArray & out);
            };

        } /* namespace security */
    } /* namespace heimweghelden */
} /* namespace de */

#endif /* SESSION_HPP_ */
